New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

read-bigint

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-bigint

👓💯 Read Unsigned/Signed Big/Little-Endian BigInt from Buffer

  • 0.1.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by42.86%
Maintainers
1
Weekly downloads
 
Created
Source

Read BigInt

NPM Version Node.js CI CodeQL Dependabot: enabled codecov Bundlesize Bundle Watched code style: prettier

👓💯 Read Unsigned/Signed Big/Little-Endian BigInt from Buffer

Install

npm install read-bigint

Usage

import {
    readBigInt64BE,
    readBigInt64LE,
    readBigUInt64BE,
    readBigUInt64LE,
} from "read-bigint";

const buffer = Buffer.from([
    0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
]);

readBigInt64BE(buffer, /* offset */ 1); // => 1234605616436508552n
readBigInt64LE(buffer, /* offset */ 1); // => -8613303245920329199n
readBigUInt64BE(buffer, /* offset */ 1); // => 1234605616436508552n
readBigUInt64LE(buffer, /* offset */ 1); // => 9833440827789222417n

The purpose of this package is to be able to read native BigInt from native Buffer. This is mostly useful when targeting Node 10 (LTS Dubnium), which supports BigInt, but does not have native methods for reading BigInt from Buffer. On Node 12 or any later version of Node, you should use the native Buffer methods instead.

API

Each of the exported methods is a direct copy of the Native Buffer.readBigInt() methods.

License

MIT

Keywords

FAQs

Package last updated on 15 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc